//简化获取id
function $(id){
    return document.getElementById(id);
}
//验证字段不为空
function validateFiled(name, tip){
    if (name.value == '') {
        alert(tip + '不能为空');
        name.focus();
        return false;
    }else {
        return true;
    }
}
//验证码切换
function change(){
    document.getElementById("checkCodeImg").src="CheckCodeServlet?random="+Math.random();
}

/*
		 * 打开新窗口
		 * f:链接地址
		 * n:窗口的名称
		 * w:窗口的宽度
		 * h:窗口的高度
		 * s:窗口是否有滚动条，1：有滚动条；0：没有滚动条 */
function openWin(f,n,w,h,s){
    sb = s == "1" ? "1" : "0";
    l = (screen.width - w)/2;
    t = (screen.height - h)/2;
    sFeatures = "left="+ l +",top="+ t +",height="+ h +",width="+ w
        + ",center=1,scrollbars=" + sb + ",status=0,directories=0,channelmode=0";
    openwin = window.open(f , n , sFeatures);
    if (!openwin.opener)
        openwin.opener = self;
    openwin.focus();
    return openwin;
}
